<script setup lang="ts">

import NewIcon from "@/components/NewIcon.vue";
defineProps(['route'])
</script>
<template>
  <el-menu-item v-if="route.children === undefined || route.children.length === 0"
                :index="route.name"
                :route="route.path"
                :key="route.name">
    <new-icon :icon="route.meta.icon?route.meta.icon:'Link'"/>
    {{route.meta.title}}
  </el-menu-item>
  <el-sub-menu v-else :index="route.name">
    <template #title>
      <new-icon :icon="route.meta.icon?route.meta.icon:'Link'"/>
      <span>{{route.meta.title}}</span>
    </template>
    <new-menu v-for="item in route.children" :route="item" :key="item.name" />
  </el-sub-menu>
</template>
<style scoped></style>